-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Default visibility for rustc-generated C symbol declarations #131519
Conversation
r? @Nadrieril rustbot has assigned @Nadrieril. Use |
Non-default visibilities should only be used for definitions, not declarations, otherwise linking can fail. Co-authored-by: Collin Baker <[email protected]>
2acf902
to
42c0494
Compare
r? compiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no expert but this makes sense to me.
It's also what clang is doing, godbolt.
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#129079 (Create `_imp__` symbols also when doing ThinLTO) - rust-lang#131208 (ABI: Pass aggregates by value on AIX) - rust-lang#131394 (fix(rustdoc): add space between struct fields and their descriptions) - rust-lang#131519 (Use Default visibility for rustc-generated C symbol declarations) - rust-lang#131541 (compiletest: Extract auxiliary-crate properties to their own module/struct) - rust-lang#131542 (next-solver: remove outdated FIXMEs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131519 - davidlattimore:intrinsics-default-vis, r=Urgau Use Default visibility for rustc-generated C symbol declarations Non-default visibilities should only be used for definitions, not declarations, otherwise linking can fail. This is based on rust-lang#123994. Issue rust-lang#123427 When I changed `default-hidden-visibility` to `default-visibility` in rust-lang#130005, I updated all places in the code that used `default-hidden-visibility`, replicating the hidden-visibility bug to also happen for protected visibility. Without this change, trying to build rustc with `-Z default-visibility=protected` fails with a link error.
This depended on rust-lang/rust#131519 rolling into the Rust compiler to fix builtins/intrinisics, which was merged in 33b1264540b. Remove ASAN ODR exceptions for Rust globals as they are no longer walked twice incorrectly when they are hidden. Disable the rust logging test in component builds for all platforms not just for Windows, now that symbol visibility is the same for all platforms. See https://crbug.com/374023535#comment13 Bug: 41484256, 40274892, 374023535 Fixed: 40278279 Cq-Include-Trybots: luci.chromium.try:linux-official,mac-official,win-official,win32-official Cq-Include-Trybots: luci.chromium.try:linux-asan-rel,mac-asan-rel,win-asan-rel Cq-Include-Trybots: luci.chromium.try:linux_chromium_dbg_ng Change-Id: I976ef679961e9db5a91bcc74f559ebbcc0bf058b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5966273 Commit-Queue: danakj <[email protected]> Reviewed-by: Arthur Eubanks <[email protected]> Cr-Commit-Position: refs/heads/main@{#1375460} NOKEYCHECK=True GitOrigin-RevId: ee3900fd57b3c580aefff15c64052904d81b7760
Non-default visibilities should only be used for definitions, not declarations, otherwise linking can fail.
This is based on #123994.
Issue #123427
When I changed
default-hidden-visibility
todefault-visibility
in #130005, I updated all places in the code that useddefault-hidden-visibility
, replicating the hidden-visibility bug to also happen for protected visibility.Without this change, trying to build rustc with
-Z default-visibility=protected
fails with a link error.